﻿using System;
using System.Data.Common;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Data.Entity.ModelConfiguration.Conventions;

namespace MVCBootstrap.EntityFramework {

	public class MembershipDbContext : DbContext {

		public DbSet<User> Users { get; set; }
		//public DbSet<UserInRole> UsersInRoles { get; set; }
		public DbSet<Role> Roles { get; set; }

		public MembershipDbContext() : base() { }
		public MembershipDbContext(String nameOrConnectionString) : base(nameOrConnectionString) { }
		public MembershipDbContext(DbCompiledModel model) : base(model) { }
		public MembershipDbContext(String nameOrConnectionString, DbCompiledModel model) : base(nameOrConnectionString, model) { }
		public MembershipDbContext(DbConnection existingConnection, Boolean contextOwnsConnection) : base(existingConnection, contextOwnsConnection) { }
		public MembershipDbContext(DbConnection exisingConnection, DbCompiledModel model, Boolean contextOwnsConnection) : base(exisingConnection, model, contextOwnsConnection) { }

		protected override void OnModelCreating(DbModelBuilder modelBuilder) {
			base.OnModelCreating(modelBuilder);

			modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
		}
	}
}